<?php
/* QQ:34734852
 * 业务联系：小鱼
 */
class BAIDUFANYI{
	public static $APPID = '20151130000007005', $APPKEY = 'gPYRpVWXNbvztgzuVY7k';
	
	public static function API( $WORD = '' ) {
	   if ( FANYI ) {
		$S  = time();
		$P  = 'q=' . rawurlencode($WORD) . '&from=auto&to=auto&appid=' . self::$APPID . '&salt=' . $S . '&sign=';
		$P .= md5(self::$APPID . $WORD . $S . self::$APPKEY);
		$U = 'http://api.fanyi.baidu.com/api/trans/vip/translate?' . $P;
		$J = json_decode( file_get_contents( $U ), true );
		unset( $P, $S, $U, $WORD );
		return !empty($J['trans_result'][0]['dst']) ? ('&nbsp;&nbsp;[' .$J['trans_result'][0]['dst'] . ']' ): '';
	   } else {
		return '';  
	   }
	}
	
	
}